package cn.tedu.boot33.mapper;

import cn.tedu.boot33.vo.Emp;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper//告诉编译器当前接口为Mapper映射接口
public interface EmpMapper {
    @Select("select * from myemp")
    List<Emp>select();

    @Delete("delete from myemp where id=#{id}")
    void delete(int id);
    //#{xx} 会自动从下面方法的参数列表中找同名的变量,
    // 如果找不到自动查找对象里面的属性的get方法
    @Insert("insert into myemp values(null,#{name},#{job},#{age},#{salary})")
    void insert(Emp emp);

    @Update("update myemp set name=#{name},job=#{job},age=#{age},salary=#{salary} where id=#{id}")
    void update(Emp emp);
}
